import 'package:flutter/material.dart';
import 'package:cached_network_image/cached_network_image.dart';

Widget GwNetHeadPortrait(String? url,
    {double width = 30,
    double? height,
    BoxFit? fit,
    BorderRadius? borderRadius,
    String placeholderName = ""}) {
  var placeholder = Image.asset(
    placeholderName,
    width: width,
    height: height == null ? width : height,
  );
  return ClipRRect(
    borderRadius: borderRadius ?? BorderRadius.circular(2),
    child: CachedNetworkImage(
      imageUrl: url ?? "",
      placeholder: (context, url) {
        return placeholder;
      },
      errorWidget: (context, url, error) => placeholder,
    ),
  );
}
